SlideShare a Scribd company logo
以下是小波变换的相关程序                                    2.Daub4 变换
                                                function y = Daub4(f)
1.Haar 变换
                                                % Level 1 Daub4 transform
function h = Haar(f)
                                                r = f(2:2:end)-sqrt(3)*f(1:2:end);
                                                s = f(1:2:end)+sqrt(3)/4*r+(sqrt(3)-
% N = length(f);
                                                2)/4*[r(2:end), r(1)];
% a = zeros(1,N/2);
                                                a = (1+sqrt(3))/sqrt(2)*s;
% d = zeros(1,N/2);
                                                d = (1-sqrt(3))/sqrt(2)*(s+[r(2:end), r(1)]);
% for m = 1:N/2
                                                y = [a, d];
% a(m) = (f(2*m-1)+f(2*m))/sqrt(2);
% d(m) = (f(2*m-1)-f(2*m))/sqrt(2);
% end                                           Daub4 逆变换
                                                function f = Daub4I(y)
% a = (f(1:2:end-1)+f(2:2:end))/sqrt(2);        % Level 1 Inverse Daub4 Transform
% d = (f(1:2:end-1)-f(2:2:end))/sqrt(2);        s = sqrt(2)/(1+sqrt(3))*y(1:end/2);
% h = [a d];                                    r = sqrt(2)/(1-sqrt(3))*[y(end),y(end/2+1:end-
                                                1)]...
h = [(f(1:2:end-1)+f(2:2:end)), ...
                                                   -[s(end),s(1:end-1)];
     (f(1:2:end-1)-f(2:2:end))]/sqrt(2);        f = y;
                                                f(1:2:end) = s-sqrt(3)/4*r-(sqrt(3)-
                                                2)/4*[r(2:end),r(1)];
Haar 逆变换
                                                f(2:2:end) = r + sqrt(3)*f(1:2:end);
function f = HaarI(h)
                                                Daub4 K 层变换
% M = length(h)/2;                              function y = Daub4K(x, k)
% f = zeros(1,2*M);
% for i=1:M                                     y = x;
% f(2*i-1:2*i) = [h(i)+h(M+i), h(i)-h(M+i)];    for i=1:k
% end
                                                  y(1:end/2^(i-1)) = Daub4(y(1:end/2^(i-1)));
                                                end
a = h(1:end/2);
d = h(end/2+1:end);                             Daub4 K 层逆变换
f = reshape([a+d; a-d],1,[])/sqrt(2);           function y = Daub4KI(x, k)
                                                % Level K Inverse Daub4 Transform
K 层 Haar 变换
                                                y = x;
function y = HaarK(f, k)
                                                for i=k:-1:1
% k-level Haar transform
y = f;                                            y(1:end/2^(i-1)) = Daub4I(y(1:end/2^(i-1)));
for i=1:k                                       end
  y(1:end/2^(i-1)) = Haar(y(1:end/2^(i-1)));
end                                             3.Daub6 变换
                                                function y = Daub6(f)
K 层 Haar 逆变换
                                                % level 1 Daub6 transform
function f = HaarKI(y, k)
                                                a1 = (1+sqrt(10)+sqrt(5+2*sqrt(10)))*sqrt(2)/32;
% k-level Inverse Haar transform
                                                a2 =
f = y;
                                                (5+sqrt(10)+3*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
for i=k:-1:1
                                                a3 = (10-
  f(1:end/2^(i-1)) = HaarI(f(1:end/2^(i-1)));   2*sqrt(10)+2*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
end                                             a4 = (10-2*sqrt(10)-
                                                2*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
                                                a5 = (5+sqrt(10)-
                                                3*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
a6 = (1+sqrt(10)-sqrt(5+2*sqrt(10)))*sqrt(2)/32;   thetap = R0/R2;
b1 = a6;                                           zeta = -a6/a1*R2^2;
b2 = -a5;
b3 = a4;                                           f = y;
b4 = -a3;                                          s2 = -R2*y(end/2+1:end);
b5 = a2;                                           r2 = y(1:end/2)/R2;
b6 = -a1;                                          s1 = s2 - zeta*r2;
R0 = a2 - a1*a6/a5;                                r1 = r2 - theta*s1 - thetap*[s1(end),s1(1:end-1)];
R1 = a4 - a3*a6/a5;                                f(2:2:end) = [s1(end),s1(1:end-1)]-
R2 = a3 - a1*R1/R0 - a5*R0/R1;                     bp*[r1(end),r1(1:end-1)]-b*r1;
a = a6/a5;                                         f(1:2:end) = [r1(end),r1(1:end-1)]-a*f(2:2:end);
b = a5/R1;
                                                  4.Daub5/3 变换
bp = a1/R0;
                                                  function y = Daub53(f)
theta = R1/R2;
                                                  % Level 1 Daub 5/3 wavelet transform
thetap = R0/R2;
                                                  y = f;
zeta = -a6/a1*R2^2;
                                                  y(end/2+1:end) = f(2:2:end)-(f(1:2:end)+
                                                  [f(3:2:end),f(end-1)])/2;
y = f;
                                                  y(1:end/2) = f(1:2:end)+
r1 = [f(3:2:end),f(1)]+a*[f(4:2:end),f(2)];
                                                  ([y(end/2+1),y(end/2+1:end-1)]
s1 = [f(4:2:end),f(2)]+bp*r1+b*[r1(2:end),r1(1)];
                                                  +y(end/2+1:end))/4;
r2 = r1+theta*s1+thetap*[s1(end),s1(1:end-1)];
s2 = s1+zeta*r2;                                  Daub5/3 逆变换
y(1:end/2) = R2*r2;
y(end/2+1:end) = -s2/R2;                          function f = Daub53I(y)
                                                  % Inverse of Level 1 Daub 5/3 Wavelet
                                                  Transform
                                                  f = y;
Daub6 逆变换
                                                  f(1:2:end) = y(1:end/2)-
function f = Daub6I(y)
                                                  ([y(end/2+1),y(end/2+1:end-1)]
% level 1 inverse Daub6 transform
                                                  +y(end/2+1:end))/4;
a1 = (1+sqrt(10)+sqrt(5+2*sqrt(10)))*sqrt(2)/32;
                                                  f(2:2:end) = y(end/2+1:end)+(f(1:2:end)+
a2 =
                                                  [f(3:2:end),f(end-1)])/2;
(5+sqrt(10)+3*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
a3 = (10-
2*sqrt(10)+2*sqrt(5+2*sqrt(10)))*sqrt(2)/32;      Daub5/3i2i 变换
a4 = (10-2*sqrt(10)-                              function y = Daub53i2i(f)
2*sqrt(5+2*sqrt(10)))*sqrt(2)/32;                 % Level 1 Daub 5/3 integer to integer wavelet
a5 = (5+sqrt(10)-                                 transform
3*sqrt(5+2*sqrt(10)))*sqrt(2)/32;                 y = f;
a6 = (1+sqrt(10)-sqrt(5+2*sqrt(10)))*sqrt(2)/32; y(end/2+1:end) = f(2:2:end)-floor((f(1:2:end)+
b1 = a6;                                          [f(3:2:end),f(end-1)])/2+1/2);
b2 = -a5;                                         y(1:end/2) = f(1:2:end)
b3 = a4;                                          +floor(([y(end/2+1),y(end/2+1:end-1)]
b4 = -a3;                                         +y(end/2+1:end))/4+1/2);
b5 = a2;
                                                  Daub5/3i2i 逆变换
b6 = -a1;
                                                  function f = Daub53i2iI(y)
R0 = a2 - a1*a6/a5;
                                                  % Inverse of Level 1 Daub 5/3 integer to integer
R1 = a4 - a3*a6/a5;
                                                  Wavelet Transform
R2 = a3 - a1*R1/R0 - a5*R0/R1;
                                                  f = y;
a = a6/a5;
                                                  f(1:2:end) = y(1:end/2)-
b = a5/R1;
                                                  floor(([y(end/2+1),y(end/2+1:end-1)]
bp = a1/R0;
                                                  +y(end/2+1:end))/4+1/2);
theta = R1/R2;
f(2:2:end) = y(end/2+1:end)+floor((f(1:2:end)+   y = f;
[f(3:2:end),f(end-1)])/2+1/2);                   for i = 1:k
                                                    for j = 1:2^(i-1)
5.Daub4 2D 变换
                                                       for p = 1:2^(i-1)
function y = Daub4_2D(f)
                                                         y((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p-
[m,n] = size(f);                                 1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D(y((j-
y = f;                                           1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i-
for i = 1:m                                      1)+1:p*n/2^(i-1)));
   y(i,:) = Daub4(y(i,:));                             end
end
                                                   end
for i = 1:n
                                                 end
  y(:,i) = Daub4(y(:,i)')';
                                                 逆变换
end
                                                 function f = Daub4p_2D_K_I(y,k)
Daub4 2D 逆变换                                     [m,n] = size(y);
function f = Daub4_2D_I(y)                       f = y;
                                                 for i = k:-1:1
[m,n] = size(y);
                                                    for j = 1:2^(i-1)
f = y;
for i = 1:m                                            for p = 1:2^(i-1)
   f(i,:) = Daub4I(f(i,:));                              f((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p-
end                                              1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D_I(f((j-
for i = 1:n                                      1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i-
  f(:,i) = Daub4I(f(:,i)')';                     1)+1:p*n/2^(i-1)));
end                                                    end
                                                   end
Daub4 2D K 层变换                                   end
function y = Daub4_2D_K(f,k)
                                                 7 图片保存信息量为原来的 99.99%
y = f;                                           function f = Daub4p_2D_K_I(y,k)
for i = 1:k                                      [m,n] = size(y);
                                                 f = y;
  y(1:end/2^(i-1),1:end/2^(i-1)) =               for i = k:-1:1
Daub4_2D(y(1:end/2^(i-1),1:end/2^(i-1)));
                                                    for j = 1:2^(i-1)
end
                                                       for p = 1:2^(i-1)
Daub4 2D K 层逆变换                                          f((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p-
function f = Daub4_2D_K_I(y,k)                   1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D_I(f((j-
                                                 1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i-
f = y;                                           1)+1:p*n/2^(i-1)));
for i = k:-1:1
                                                       end
  f(1:end/2^(i-1),1:end/2^(i-1)) =
                                                   end
Daub4_2D_I(f(1:end/2^(i-1),1:end/2^(i-1)));
end                                              end

6.Daub4 2D P 变换
function y = Daub4p_2D_K(f,k)

[m,n] = size(f);

More Related Content

What's hot

Transfer functions, poles and zeros.
Transfer functions, poles and zeros.Transfer functions, poles and zeros.
Transfer functions, poles and zeros.
ARIF HUSSAIN
 
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
Mathankumar S
 
Control systems lab task
Control systems lab taskControl systems lab task
Control systems lab task
ARIF HUSSAIN
 
Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292
lucky859450
 
Aero446EricWoodsHW2
Aero446EricWoodsHW2Aero446EricWoodsHW2
Aero446EricWoodsHW2Eric Woods
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_system
maheshwareshwar
 
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
Kota Abe
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functions
Matthew Leingang
 
Confidence intervalanalysis methodology_eka
Confidence intervalanalysis methodology_ekaConfidence intervalanalysis methodology_eka
Confidence intervalanalysis methodology_ekabfmresearch
 
Tele4653 l7
Tele4653 l7Tele4653 l7
Tele4653 l7Vin Voro
 
Laplace
LaplaceLaplace
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
Gota Morota
 

What's hot (14)

Transfer functions, poles and zeros.
Transfer functions, poles and zeros.Transfer functions, poles and zeros.
Transfer functions, poles and zeros.
 
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
Power Systems Engineering - Matlab programs for Power system Simulation Lab -...
 
Control systems lab task
Control systems lab taskControl systems lab task
Control systems lab task
 
Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292
 
Aero446EricWoodsHW2
Aero446EricWoodsHW2Aero446EricWoodsHW2
Aero446EricWoodsHW2
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_system
 
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
高いChurn耐性と検索性能を持つキー順序保存型構造化オーバレイネットワークSuzakuの提案と評価
 
Project2
Project2Project2
Project2
 
Lesson 7: Vector-valued functions
Lesson 7: Vector-valued functionsLesson 7: Vector-valued functions
Lesson 7: Vector-valued functions
 
Confidence intervalanalysis methodology_eka
Confidence intervalanalysis methodology_ekaConfidence intervalanalysis methodology_eka
Confidence intervalanalysis methodology_eka
 
Tele4653 l7
Tele4653 l7Tele4653 l7
Tele4653 l7
 
Laplace
LaplaceLaplace
Laplace
 
Hilbert
HilbertHilbert
Hilbert
 
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generali...
 

Similar to 小波变换程序

#Import standard math functions from math import import .docx
#Import standard math functions from math import  import .docx#Import standard math functions from math import  import .docx
#Import standard math functions from math import import .docx
gertrudebellgrove
 
matlab codes.pdf
matlab codes.pdfmatlab codes.pdf
matlab codes.pdf
EdysaulCondorhuancar
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)
thanh nguyen
 
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
Jason Li
 
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
Jason Li
 
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
Harrisson David Assis Santos
 
Laplace transforms
Laplace transformsLaplace transforms
Laplace transforms
Awais Chaudhary
 
Laplace transforms
Laplace transformsLaplace transforms
Laplace transforms
Karnav Rana
 
Inverse Laplace Transform
Inverse Laplace TransformInverse Laplace Transform
Inverse Laplace Transform
Vishnu V
 
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
Cikgu Pejal
 
Segundo teorema
Segundo teoremaSegundo teorema
Segundo teorema
martha-judith
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
COMSATS Abbottabad
 
Inverse laplace
Inverse laplaceInverse laplace
Inverse laplace
FrancisPrince Salazar
 
Ejercicio de fasores
Ejercicio de fasoresEjercicio de fasores
Ejercicio de fasores
dpancheins
 
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docxMATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
andreecapon
 
Laplace_1.ppt
Laplace_1.pptLaplace_1.ppt
Laplace_1.ppt
cantatebrugyral
 

Similar to 小波变换程序 (20)

#Import standard math functions from math import import .docx
#Import standard math functions from math import  import .docx#Import standard math functions from math import  import .docx
#Import standard math functions from math import import .docx
 
matlab codes.pdf
matlab codes.pdfmatlab codes.pdf
matlab codes.pdf
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)
 
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
Image Compression Comparison Using Golden Section Transform, CDF 5/3 (Le Gall...
 
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
Image Compression Comparison Using Golden Section Transform, Haar Wavelet Tra...
 
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
[Paul lorrain] solutions_manual_for_electromagneti(bookos.org)
 
Laplace transforms
Laplace transformsLaplace transforms
Laplace transforms
 
Laplace table
Laplace tableLaplace table
Laplace table
 
Laplace transforms
Laplace transformsLaplace transforms
Laplace transforms
 
Laplace table
Laplace tableLaplace table
Laplace table
 
Inverse Laplace Transform
Inverse Laplace TransformInverse Laplace Transform
Inverse Laplace Transform
 
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
Trial penang 2014 spm matematik tambahan k1 k2 skema [scan]
 
Directional derivative and gradient
Directional derivative and gradientDirectional derivative and gradient
Directional derivative and gradient
 
Segundo teorema
Segundo teoremaSegundo teorema
Segundo teorema
 
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLABMathematical Modelling of Electrical/Mechanical modellinng in MATLAB
Mathematical Modelling of Electrical/Mechanical modellinng in MATLAB
 
Abstract
AbstractAbstract
Abstract
 
Inverse laplace
Inverse laplaceInverse laplace
Inverse laplace
 
Ejercicio de fasores
Ejercicio de fasoresEjercicio de fasores
Ejercicio de fasores
 
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docxMATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
 
Laplace_1.ppt
Laplace_1.pptLaplace_1.ppt
Laplace_1.ppt
 

More from byron zhao

从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】byron zhao
 
从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】byron zhao
 
网页设计语言教程Html css
网页设计语言教程Html css网页设计语言教程Html css
网页设计语言教程Html cssbyron zhao
 
Digital booklet sparks fly deluxe
Digital booklet   sparks fly deluxeDigital booklet   sparks fly deluxe
Digital booklet sparks fly deluxebyron zhao
 
《电子技术基础(模拟部分)》康华光第五版...(1)
《电子技术基础(模拟部分)》康华光第五版...(1)《电子技术基础(模拟部分)》康华光第五版...(1)
《电子技术基础(模拟部分)》康华光第五版...(1)
byron zhao
 
回转器的原理与应用
回转器的原理与应用回转器的原理与应用
回转器的原理与应用byron zhao
 
新概念第四册课文打印版
新概念第四册课文打印版新概念第四册课文打印版
新概念第四册课文打印版byron zhao
 
实验报告4:使用SQL语句进行SQL Server 2000数据库操作
实验报告4:使用SQL语句进行SQL Server 2000数据库操作实验报告4:使用SQL语句进行SQL Server 2000数据库操作
实验报告4:使用SQL语句进行SQL Server 2000数据库操作byron zhao
 
未命名 1.odt
未命名 1.odt未命名 1.odt
未命名 1.odtbyron zhao
 
小波变换程序.odt
小波变换程序.odt小波变换程序.odt
小波变换程序.odtbyron zhao
 
健康上网专家密码
健康上网专家密码健康上网专家密码
健康上网专家密码byron zhao
 
大物实验报告(太阳能电池).odt
大物实验报告(太阳能电池).odt大物实验报告(太阳能电池).odt
大物实验报告(太阳能电池).odtbyron zhao
 
2009级 截止至2011年1月成绩汇总表
2009级 截止至2011年1月成绩汇总表2009级 截止至2011年1月成绩汇总表
2009级 截止至2011年1月成绩汇总表byron zhao
 
就业是大学生校园生活质量的试金石.odt
就业是大学生校园生活质量的试金石.odt就业是大学生校园生活质量的试金石.odt
就业是大学生校园生活质量的试金石.odtbyron zhao
 

More from byron zhao (20)

从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】
 
从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】从研究生角度,回望大学四年数学建模路【原创】
从研究生角度,回望大学四年数学建模路【原创】
 
网页设计语言教程Html css
网页设计语言教程Html css网页设计语言教程Html css
网页设计语言教程Html css
 
Digital booklet sparks fly deluxe
Digital booklet   sparks fly deluxeDigital booklet   sparks fly deluxe
Digital booklet sparks fly deluxe
 
《电子技术基础(模拟部分)》康华光第五版...(1)
《电子技术基础(模拟部分)》康华光第五版...(1)《电子技术基础(模拟部分)》康华光第五版...(1)
《电子技术基础(模拟部分)》康华光第五版...(1)
 
电路作业
电路作业电路作业
电路作业
 
Multisim8
Multisim8Multisim8
Multisim8
 
回转器的原理与应用
回转器的原理与应用回转器的原理与应用
回转器的原理与应用
 
新概念第四册课文打印版
新概念第四册课文打印版新概念第四册课文打印版
新概念第四册课文打印版
 
实验报告4:使用SQL语句进行SQL Server 2000数据库操作
实验报告4:使用SQL语句进行SQL Server 2000数据库操作实验报告4:使用SQL语句进行SQL Server 2000数据库操作
实验报告4:使用SQL语句进行SQL Server 2000数据库操作
 
未命名 1.odt
未命名 1.odt未命名 1.odt
未命名 1.odt
 
027501-01
027501-01027501-01
027501-01
 
未命名 24
未命名 24未命名 24
未命名 24
 
小波变换程序.odt
小波变换程序.odt小波变换程序.odt
小波变换程序.odt
 
刚体
刚体刚体
刚体
 
健康上网专家密码
健康上网专家密码健康上网专家密码
健康上网专家密码
 
大物实验报告(太阳能电池).odt
大物实验报告(太阳能电池).odt大物实验报告(太阳能电池).odt
大物实验报告(太阳能电池).odt
 
2009级 截止至2011年1月成绩汇总表
2009级 截止至2011年1月成绩汇总表2009级 截止至2011年1月成绩汇总表
2009级 截止至2011年1月成绩汇总表
 
电路作业
电路作业电路作业
电路作业
 
就业是大学生校园生活质量的试金石.odt
就业是大学生校园生活质量的试金石.odt就业是大学生校园生活质量的试金石.odt
就业是大学生校园生活质量的试金石.odt
 

小波变换程序

  • 1. 以下是小波变换的相关程序 2.Daub4 变换 function y = Daub4(f) 1.Haar 变换 % Level 1 Daub4 transform function h = Haar(f) r = f(2:2:end)-sqrt(3)*f(1:2:end); s = f(1:2:end)+sqrt(3)/4*r+(sqrt(3)- % N = length(f); 2)/4*[r(2:end), r(1)]; % a = zeros(1,N/2); a = (1+sqrt(3))/sqrt(2)*s; % d = zeros(1,N/2); d = (1-sqrt(3))/sqrt(2)*(s+[r(2:end), r(1)]); % for m = 1:N/2 y = [a, d]; % a(m) = (f(2*m-1)+f(2*m))/sqrt(2); % d(m) = (f(2*m-1)-f(2*m))/sqrt(2); % end Daub4 逆变换 function f = Daub4I(y) % a = (f(1:2:end-1)+f(2:2:end))/sqrt(2); % Level 1 Inverse Daub4 Transform % d = (f(1:2:end-1)-f(2:2:end))/sqrt(2); s = sqrt(2)/(1+sqrt(3))*y(1:end/2); % h = [a d]; r = sqrt(2)/(1-sqrt(3))*[y(end),y(end/2+1:end- 1)]... h = [(f(1:2:end-1)+f(2:2:end)), ... -[s(end),s(1:end-1)]; (f(1:2:end-1)-f(2:2:end))]/sqrt(2); f = y; f(1:2:end) = s-sqrt(3)/4*r-(sqrt(3)- 2)/4*[r(2:end),r(1)]; Haar 逆变换 f(2:2:end) = r + sqrt(3)*f(1:2:end); function f = HaarI(h) Daub4 K 层变换 % M = length(h)/2; function y = Daub4K(x, k) % f = zeros(1,2*M); % for i=1:M y = x; % f(2*i-1:2*i) = [h(i)+h(M+i), h(i)-h(M+i)]; for i=1:k % end y(1:end/2^(i-1)) = Daub4(y(1:end/2^(i-1))); end a = h(1:end/2); d = h(end/2+1:end); Daub4 K 层逆变换 f = reshape([a+d; a-d],1,[])/sqrt(2); function y = Daub4KI(x, k) % Level K Inverse Daub4 Transform K 层 Haar 变换 y = x; function y = HaarK(f, k) for i=k:-1:1 % k-level Haar transform y = f; y(1:end/2^(i-1)) = Daub4I(y(1:end/2^(i-1))); for i=1:k end y(1:end/2^(i-1)) = Haar(y(1:end/2^(i-1))); end 3.Daub6 变换 function y = Daub6(f) K 层 Haar 逆变换 % level 1 Daub6 transform function f = HaarKI(y, k) a1 = (1+sqrt(10)+sqrt(5+2*sqrt(10)))*sqrt(2)/32; % k-level Inverse Haar transform a2 = f = y; (5+sqrt(10)+3*sqrt(5+2*sqrt(10)))*sqrt(2)/32; for i=k:-1:1 a3 = (10- f(1:end/2^(i-1)) = HaarI(f(1:end/2^(i-1))); 2*sqrt(10)+2*sqrt(5+2*sqrt(10)))*sqrt(2)/32; end a4 = (10-2*sqrt(10)- 2*sqrt(5+2*sqrt(10)))*sqrt(2)/32; a5 = (5+sqrt(10)- 3*sqrt(5+2*sqrt(10)))*sqrt(2)/32;
  • 2. a6 = (1+sqrt(10)-sqrt(5+2*sqrt(10)))*sqrt(2)/32; thetap = R0/R2; b1 = a6; zeta = -a6/a1*R2^2; b2 = -a5; b3 = a4; f = y; b4 = -a3; s2 = -R2*y(end/2+1:end); b5 = a2; r2 = y(1:end/2)/R2; b6 = -a1; s1 = s2 - zeta*r2; R0 = a2 - a1*a6/a5; r1 = r2 - theta*s1 - thetap*[s1(end),s1(1:end-1)]; R1 = a4 - a3*a6/a5; f(2:2:end) = [s1(end),s1(1:end-1)]- R2 = a3 - a1*R1/R0 - a5*R0/R1; bp*[r1(end),r1(1:end-1)]-b*r1; a = a6/a5; f(1:2:end) = [r1(end),r1(1:end-1)]-a*f(2:2:end); b = a5/R1; 4.Daub5/3 变换 bp = a1/R0; function y = Daub53(f) theta = R1/R2; % Level 1 Daub 5/3 wavelet transform thetap = R0/R2; y = f; zeta = -a6/a1*R2^2; y(end/2+1:end) = f(2:2:end)-(f(1:2:end)+ [f(3:2:end),f(end-1)])/2; y = f; y(1:end/2) = f(1:2:end)+ r1 = [f(3:2:end),f(1)]+a*[f(4:2:end),f(2)]; ([y(end/2+1),y(end/2+1:end-1)] s1 = [f(4:2:end),f(2)]+bp*r1+b*[r1(2:end),r1(1)]; +y(end/2+1:end))/4; r2 = r1+theta*s1+thetap*[s1(end),s1(1:end-1)]; s2 = s1+zeta*r2; Daub5/3 逆变换 y(1:end/2) = R2*r2; y(end/2+1:end) = -s2/R2; function f = Daub53I(y) % Inverse of Level 1 Daub 5/3 Wavelet Transform f = y; Daub6 逆变换 f(1:2:end) = y(1:end/2)- function f = Daub6I(y) ([y(end/2+1),y(end/2+1:end-1)] % level 1 inverse Daub6 transform +y(end/2+1:end))/4; a1 = (1+sqrt(10)+sqrt(5+2*sqrt(10)))*sqrt(2)/32; f(2:2:end) = y(end/2+1:end)+(f(1:2:end)+ a2 = [f(3:2:end),f(end-1)])/2; (5+sqrt(10)+3*sqrt(5+2*sqrt(10)))*sqrt(2)/32; a3 = (10- 2*sqrt(10)+2*sqrt(5+2*sqrt(10)))*sqrt(2)/32; Daub5/3i2i 变换 a4 = (10-2*sqrt(10)- function y = Daub53i2i(f) 2*sqrt(5+2*sqrt(10)))*sqrt(2)/32; % Level 1 Daub 5/3 integer to integer wavelet a5 = (5+sqrt(10)- transform 3*sqrt(5+2*sqrt(10)))*sqrt(2)/32; y = f; a6 = (1+sqrt(10)-sqrt(5+2*sqrt(10)))*sqrt(2)/32; y(end/2+1:end) = f(2:2:end)-floor((f(1:2:end)+ b1 = a6; [f(3:2:end),f(end-1)])/2+1/2); b2 = -a5; y(1:end/2) = f(1:2:end) b3 = a4; +floor(([y(end/2+1),y(end/2+1:end-1)] b4 = -a3; +y(end/2+1:end))/4+1/2); b5 = a2; Daub5/3i2i 逆变换 b6 = -a1; function f = Daub53i2iI(y) R0 = a2 - a1*a6/a5; % Inverse of Level 1 Daub 5/3 integer to integer R1 = a4 - a3*a6/a5; Wavelet Transform R2 = a3 - a1*R1/R0 - a5*R0/R1; f = y; a = a6/a5; f(1:2:end) = y(1:end/2)- b = a5/R1; floor(([y(end/2+1),y(end/2+1:end-1)] bp = a1/R0; +y(end/2+1:end))/4+1/2); theta = R1/R2;
  • 3. f(2:2:end) = y(end/2+1:end)+floor((f(1:2:end)+ y = f; [f(3:2:end),f(end-1)])/2+1/2); for i = 1:k for j = 1:2^(i-1) 5.Daub4 2D 变换 for p = 1:2^(i-1) function y = Daub4_2D(f) y((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p- [m,n] = size(f); 1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D(y((j- y = f; 1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i- for i = 1:m 1)+1:p*n/2^(i-1))); y(i,:) = Daub4(y(i,:)); end end end for i = 1:n end y(:,i) = Daub4(y(:,i)')'; 逆变换 end function f = Daub4p_2D_K_I(y,k) Daub4 2D 逆变换 [m,n] = size(y); function f = Daub4_2D_I(y) f = y; for i = k:-1:1 [m,n] = size(y); for j = 1:2^(i-1) f = y; for i = 1:m for p = 1:2^(i-1) f(i,:) = Daub4I(f(i,:)); f((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p- end 1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D_I(f((j- for i = 1:n 1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i- f(:,i) = Daub4I(f(:,i)')'; 1)+1:p*n/2^(i-1))); end end end Daub4 2D K 层变换 end function y = Daub4_2D_K(f,k) 7 图片保存信息量为原来的 99.99% y = f; function f = Daub4p_2D_K_I(y,k) for i = 1:k [m,n] = size(y); f = y; y(1:end/2^(i-1),1:end/2^(i-1)) = for i = k:-1:1 Daub4_2D(y(1:end/2^(i-1),1:end/2^(i-1))); for j = 1:2^(i-1) end for p = 1:2^(i-1) Daub4 2D K 层逆变换 f((j-1)*m/2^(i-1)+1:j*m/2^(i-1),(p- function f = Daub4_2D_K_I(y,k) 1)*n/2^(i-1)+1:p*n/2^(i-1)) = Daub4_2D_I(f((j- 1)*m/2^(i-1)+1:j*m/2^(i-1),(p-1)*n/2^(i- f = y; 1)+1:p*n/2^(i-1))); for i = k:-1:1 end f(1:end/2^(i-1),1:end/2^(i-1)) = end Daub4_2D_I(f(1:end/2^(i-1),1:end/2^(i-1))); end end 6.Daub4 2D P 变换 function y = Daub4p_2D_K(f,k) [m,n] = size(f);